package org.lease.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.lease.mapper.FacilityInfoMapper;
import org.lease.model.entity.FacilityInfo;
import org.lease.model.enums.ItemType;
import org.lease.service.FacilityInfoService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FacilityInfoServiceImpl extends ServiceImpl<FacilityInfoMapper, FacilityInfo> implements FacilityInfoService {
    @Override
    public List<FacilityInfo> listByType(ItemType itemType) {
        LambdaQueryWrapper<FacilityInfo> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(itemType != null, FacilityInfo::getType, itemType);
        return list(wrapper);
    }
}
